package ui.changeweeklydetails;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Dimension;

public class BarPanel extends JPanel {

	float barHeight = 0;
	Color color;
	
	public static void main(String [] args)
	{
		JFrame f = new JFrame();
		BarPanel barPanel = new BarPanel(Color.blue);
		barPanel.setBarHeight(0.7f);
		f.getContentPane().add(barPanel);
		f.setVisible(true);
		f.setSize(400, 400);
	}
	
	/**
	 * Create the panel.
	 */
	public BarPanel(Color c) {
		setPreferredSize(new Dimension(10, 300));
		color = c;
	}

	public void paint(Graphics g)
	{
		g.setColor(color);
		g.fillRect(0, this.getHeight() - (int) (this.getHeight() * barHeight), this.getWidth(), (int) (this.getHeight() * barHeight));
	}
	
	public void setBarHeight(float h)
	{
		barHeight = h;
		//repaint();
	}
	
}
